/**
 *@description:
 *@file: compute_shader.h
 *@author: snow-tyan
 *@email: zziywang@163.com
 *@date: 23 February 2023
 *@copyright: 2018-2022 AiRiA. All rights reserved.
 */

#include <glad/glad.h>
#include <string>

namespace mygl {

class ComputeShader {
 public:
  ComputeShader(std::string compute_path);
  ~ComputeShader();

  unsigned int program_id() const { return program_id_; }

  int Init();
  void UseProgram() const;
  void DeleteProgram() const;

 private:
  int compile(const char *compute_source);
  static int checkCompileErrors(GLuint shader, const char *prefix);
  static int checkLinkErrors(GLuint program, const char *prefix);

 private:
  std::string compute_path_;
  GLuint program_id_;
};

}  // namespace mygl